<?php
include(dirname(__FILE__).'/top-bottom-share-data.php');
$dt = new DataTable(constant('DB_TABLE_PRODUCT'));
$GLOBALS['GV_IMAGE_PATH'] = 'product/';
$act = isset($_REQUEST['act'])?$_REQUEST['act']:'';
$condition = "`is_delete`='N'";

$GLOBALS['PAGE_CAT_NAME'] = '';
if ( isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] > 0) {
	$condition .= sprintf(" AND `cat_id`=%d", $_REQUEST['cat_id']);
	$GLOBALS['PAGE_CAT_NAME'] = $GLOBALS['GV_PRODUCT_CAT'][$_REQUEST['cat_id']];
}
$page = isset($_REQUEST['page'])?$_REQUEST['page']:1;
$page_size = isset($_REQUEST['page_size'])?$_REQUEST['page_size']:6;
$offset = $page_size * ( $page - 1);
$GLOBALS['PAGE_LIST_DATA'] = $dt->get_list($condition, array('-date','-id'), $page_size, $offset);
$total_row =  $dt->get_count($condition);
$GLOBALS['PAGE_LIST_TOTAL_PAGE'] = ceil($total_row/$page_size);
$GLOBALS['PAGE_LIST_PAGE'] = $page;
$_REQUEST['page'] = $page;
?>